<template>
	<view class="container">
		<view class="list" v-if="list.length > 0">
			<view class="box" hover-class="hoverClass" v-for="item in list" :key="item.id" @click="goDetail">
				<view class="info">
					<view class="name">
						{{ item.role_name }}
					</view>
					<view class="status">状态：{{ item.role_status_name }}</view>
				</view>
				<uni-icons type="right" size="16" color="#bbb"></uni-icons>
			</view>
		</view>
		<view class="empty" v-else>
			<image class="image" src="@/static/img/empty.png" mode="aspectFit"></image>
			<view class="emptyWord">暂无数据</view>
		</view>
	</view>
</template>

<script>
import api from '@/api/api';
export default {
	data() {
		return {
			list: []
		};
	},
	onShow() {
		this.gitList();
	},
	onPullDownRefresh() {
		this.gitList();
	},
	methods: {
		goDetail() {
			uni.showModal({
				title: '提示',
				content: '请前往PC端管理角色岗位'
			});
		},
		gitList() {
			uni.showLoading({
				title: '加载中...'
			});
			api.roleList({}).then((res) => {
				this.list = res.data;
				uni.stopPullDownRefresh();
				uni.hideLoading();
			});
		}
	}
};
</script>

<style lang="scss">
.container {
	padding: 20rpx;
	.list {
		.box {
			background: #fff;
			border-radius: 16rpx;
			margin-bottom: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 20rpx;
			.info {
				.name {
					font-size: 28rpx;
					font-weight: bold;
					margin-bottom: 20rpx;
				}
				.status {
					font-size: 26rpx;
					color: $uni-base-color;
				}
			}
		}
	}
}
</style>
